// 统计单词数量
package wordcounter

import (
	"bufio"
	"strings"
)

type WordCounter int

func (c *WordCounter) Write(p []byte) (int, error) {
	reader := strings.NewReader(string(p))
	input := bufio.NewScanner(reader)
	input.Split(bufio.ScanWords)

	for input.Scan() {
		*c++
	}
	return len(p), nil
}
